<?php
$this->sendDebugMessage("pass model start");

$user = $this->userCenter->userList[$ip];
$tid = $user->tableID;
$rid = $user->roomID;
$tb = $this->userCenter->roomList[$rid]->tableList[$tid];

$state = $tb->cardState;

include "checkUno.php";

$user->uno = false;

//生成罚牌
$pcard = getPunishCard($tb,$user);

//计算下一个出牌者
$nextSeatID = getNextPlayer($state,$tb);

//罚牌后重置
$state->reset();
$state->punished = true;

$response = new Response();
$response->event = "SE_PASS";
$response->body = '{"seat":"'.$user->seatID.'","userID":"'.$ip.'","card":["'.implode("\",\"",$pcard).'"],"nextSeatID":"'.$nextSeatID.'","state":'.$state.'}';
$this->sendData($ip,$response);

$response = new Response();
$response->event = "SE_PASS_UPDATE";
$response->body = '{"seat":"'.$user->seatID.'","num":'.count($pcard).',"nextSeatID":"'.$nextSeatID.'","state":'.$state.'}';
$this->broadcastGroup($response,$this->userCenter->roomList[$rid]->userList,array($ip));
$tb->currentPlayerSeatID = $nextSeatID;

$this->sendDebugMessage("pass model end");

